Skip to content

feat(web): optional Vim keybindings in the editor - #32

Open
silviu-life wants to merge 1 commit into
RyPope:mainfrom
silviu-life:feat/vim-mode
Open

silviu-life wants to merge 1 commit into
RyPope:mainfrom
silviu-life:feat/vim-mode

Conversation

@silviu-life

Copy link
Copy Markdown

What and why

Adds optional Vim keybindings to the code editor, for people who practise in Vim and keep reaching for dd/ciw in the browser.

  • A Vim button in the editor toolbar (next to the font-size controls) turns Vim mode on or off. It's off by default and remembered with the other editor preferences (pref("vim")).
  • When it's on, a mode line under the editor shows the current mode and pending keys (--NORMAL--, --INSERT--, : commands).
  • Built on monaco-vim 0.4.4 (MIT, pinned exactly), so it's bundled and works offline like the rest of Monaco.
  • vite.config.ts gets a one-line alias: monaco-vim imports monaco-editor/esm/vs/..., which monaco-editor 0.57's exports map rejects, so the Docker web build failed without it. The alias maps those imports to the paths monaco-editor exports.
  • ⌘↵ / ⌘⇧↵ (Run / Submit) still work in Vim mode. In Normal mode Vim takes some Ctrl keys for itself, as usual (Ctrl+V block select, Ctrl+R redo).

How it was tested

  • npm run lint, format:check, typecheck, npm test and npm run build pass. The full app image builds with docker compose up -d --build.
  • Checked by hand with Playwright against a running instance: the toggle sets aria-pressed; o gives --INSERT-- and inserts text, Esc gives --NORMAL--; the setting survives a reload.
  • No new unit test. The web suite only covers lib/ logic and has no component test setup, and this change is UI wiring. The production build step in make test-web does catch the alias regression. Happy to add a component test if you'd like one, though that means adding jsdom and Testing Library.
Before After (Vim on, back in Normal mode)
before after

Checklist

  • make lint and make test pass (web parts run; backend/runner untouched)
  • Behaviour changes come with a test that fails without them (see above)
  • API response changes: n/a
  • UI changes: screenshots attached
  • No problem statements, test cases or solutions from upstream sources are committed

🤖 Generated with Claude Code

Add a Vim toggle to the editor toolbar, backed by monaco-vim. The choice is
stored with the other editor preferences, and a mode line under the editor
shows the current mode and pending commands.

monaco-vim imports monaco-editor/esm/vs/... paths, which monaco-editor 0.57's
exports map rejects, so vite.config.ts aliases them to the exported paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant